<template>
	<view>
		<view class="u-demo-block__content" style="margin: 16rpx;">
			<view class="u-page__tag-item">
				<u-search v-model="queryKey" 
					placeholder="请输入成品编码或名称、物料编码或名称"
					@custom="click2Query"
					@search="click2Query"></u-search>
			</view>
		</view>
		<view>
			<u-tabs
				@click="tabClick"
				:list="list1"
				lineWidth="90"
				lineColor="#f56c6c"
				:activeStyle="{
					color: '#303133',
					fontWeight: 'bold',
					transform: 'scale(1.05)'
				}"
				:inactiveStyle="{
					color: '#606266',
					transform: 'scale(1)'
				}"
				itemStyle="padding-left: 20px; padding-right: 15px; height: 34px;">
				<!-- <view slot="right" style="padding-left: 10px;padding-right: 10px;">
					<u-button class="btn submit" 
						shape="circle" 
						size="large" 
						type="primary" 
						@click="submitPickingPre" v-if="action!='PICK_DETAIL'">提交领料</u-button>
				</view> -->
			</u-tabs>
		</view>
		<view class="card-container">
			<view class="card-wrap">
				<view class="card-item">
					订单合同：<u-tooltip :text="contractCode" bgColor="#e3e4e6"></u-tooltip>
				</view>
				<view class="card-item">
					领料班组：<u-tooltip :text="`${teamInfo ? teamInfo.deptName : teamId}`" bgColor="#e3e4e6"></u-tooltip>
				</view>
				<view class="card-item">
					产地：<uni-data-checkbox multiple v-model="prdFactorySelecteds" :localdata="prdFactoryList" @change="prdFactoryChange"></uni-data-checkbox>
				</view>
			
				<!-- 产品列表（主表） -->
				<view style="margin-top: 0px;">
					<uni-table ref="tableOfProduct" :loading="detailLoading"
						border
						stripe 
						type="selection" 
						@selection-change="selectionChange"
						emptyText="暂无更多数据">
					<uni-tr style="background-color: #dbfbdb;">
						<uni-th align="left" width="5" style="font-size: 12px;color: #62c188;">序号</uni-th>
						<uni-th align="left" width="40" style="font-size: 12px;color: #62c188;">产地</uni-th>
						<uni-th align="left" width="40" style="font-size: 12px;color: #62c188;">产品编码</uni-th>
						<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">物料编码</uni-th>
						<uni-th align="left" width="80" style="font-size: 12px;color: #62c188;">物料名称</uni-th>
						<uni-th align="left" width="80" style="font-size: 12px;color: #62c188;">物料规格</uni-th>
						<uni-th align="left" width="50" style="font-size: 12px;color: #62c188;">业务状态</uni-th>
						<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">生产数量</uni-th>
						<uni-th align="left" style="font-size: 12px;color: #62c188;">已齐套数量</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in workOrderList" :key="index">
						<uni-td align="left" style="font-size: 12px;text-align: left;" :disabled="item.kingStatus!='6'">{{ index+1 }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.prdFactoryLabel }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.productCode }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.bomCode }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.bomName }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.bomStandard }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.kingStatusDesc }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.maxPickingNum }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.finishQty }}</uni-td>
					</uni-tr>
					</uni-table>
					<view>
						<u-row customStyle="margin-bottom: 10px">
							<u-col span="6" customStyle="margin-right: 5px">
								<u-button type="primary" 
								@click="bomCodeSelectChange('OK')" 
								:loading="bomMaterialLoading" 
								loadingText="加载中,请稍后">确认</u-button>
							</u-col>
							<u-col span="6">
								<u-button type="primary" 
								@click="bomCodeSelectChange('CANCEL')" 
								:loading="bomMaterialLoading" 
								loadingText="加载中,请稍后">撤销</u-button>
							</u-col>
						</u-row>
						
					</view>
				</view>
				
				<!-- 物料清单（物料明细表） -->
				<view style="margin-top: 6px;">
					<u--text text="物料清单列表(向右滑可单独领料):" style="color: #2d2e31;"></u--text>
					<u--text type="warning" text="注意:如果提交了领料请求之后,已领数量有可能还未变化,是因推金蝶还未成功,可以进领料记录查看状态.\n 已领数量:已审核的数据  在途数量:未审核的数据"></u--text>
					
					<view>
						<u-row customStyle="margin-bottom: 10px">
							<u-col span="6" customStyle="margin-right: 5px">
								<u-button type="primary" @click="loadRealStockNum" :loading="realStockLoading" loadingText="加载中,请稍后">刷新物料实时库存</u-button>
							</u-col>
							<u-col span="6">
								<u-button type="primary" @click="loadAllOtherOnWayQty" :loading="otherOnWayLoading" loadingText="加载中,请稍后">刷新在途领料单数量</u-button>
							</u-col>
						</u-row>
						
					</view>
					<uni-table ref="table" :loading="detailLoading"
						border
						stripe 
						type="" 
						style="padding-bottom: 80px;"
						emptyText="暂无更多数据">
						<uni-tr style="background-color: #dbfbdb;">
							<uni-th align="left" width="5" style="font-size: 12px;color: #62c188;">序号</uni-th>
							<uni-th align="left" width="30" style="font-size: 12px;color: #62c188;">产品数</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">物料编码</uni-th>
							<uni-th align="left" width="80" style="font-size: 12px;color: #62c188;">物料名称</uni-th>
							<!-- <uni-th align="left" width="30" style="font-size: 12px;color: #62c188;">单位</uni-th> -->
							<uni-th align="left" style="font-size: 12px;color: #62c188;">物料规格</uni-th>
							<uni-th align="left" width="80" style="font-size: 12px;color: #62c188;">实时库存</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">申请数量</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">应发数量</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">已领数量</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">本合同在途量</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">其他合同在途量</uni-th>
							<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">未领数量</uni-th>
							<uni-th align="left" width="210" style="font-size: 12px;color: #62c188;" v-if="action!='PICK_DETAIL'">应领数量</uni-th>
						</uni-tr>
				
						<uni-tr v-for="(item, index) in allSubMaterialList" :key="index">
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ index+1 }}</uni-td>
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.parentBomCodeList.length }}</uni-td>
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.bomCode }}</uni-td>
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.bomName }}</uni-td>
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.bomStandard }}</uni-td>
							<uni-td align="left" style="font-size: 12px;text-align: left;">
								<u-tag :text="item.realStockNum" @click="loadRealStockNumByBomCode(item)" type="success" size="mini" plain plainFill></u-tag>
							</uni-td> <!-- 实际库存 -->
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.appQty }}</uni-td> <!-- 申请数量 -->
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.needQty }}</uni-td> <!-- 应发数量 -->
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.pickedQty }}</uni-td> <!--已领数量-->
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.onWayQty }}</uni-td> <!--在途数量-->
							<uni-td align="left" style="font-size: 12px;text-align: left;">
								<u-tag :text="item.otherContractOnWayQty" @click="loadOtherOnWayQty(item)" type="success" size="mini" plain plainFill></u-tag>
							</uni-td> <!--其他合同统一物料在途数量-->
							<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.noPickedQty }}</uni-td> <!--未领数量-->
							<uni-td align="left" v-if="action!='PICK_DETAIL'">
								  <uni-easyinput type="digit" 
									  v-model="item.todayRecvNum" 
									  @blur="todayRecvNumChange(item)"
									  @clear="clearRecvNum(item)"
									  placeholder="应领数量" />
							</uni-td>
						</uni-tr>
					</uni-table>
				</view>
			</view>
		</view>
		
		<view v-if="this.workOrderList.length == 0" style="padding-top: 60px;">
			<u-loading-icon text="数据加载中" textSize="18" color="#19be6b" :show="loadingShow"></u-loading-icon>
			<u-empty mode="data" v-if="!loadingShow"></u-empty>
		</view>
		
		<!-- <view class="float-button">
			<u-button type="primary" 
			text="提交领料" 
			size="large" shape="circle" 
			@click="submitPickingPre" v-if="action!='PICK_DETAIL'"></u-button>
		</view>
		<view class="float-button-right">
			<u-button type="primary"
			text="全部领料" 
			size="large" shape="circle" 
			@click="submitPickingPreOfAll" v-if="action!='PICK_DETAIL'"></u-button>
		</view> -->
		
		<!-- 库存列表数据 -->
		<uni-popup ref="stockPopup" :mask-click="false">
			<view class="content">
				<view class="itme-box">
					<view class="h-table" v-if="selectedBom!== null">
						<uni-section class="mb-10" title="物料详情`" 
							:sub-title="`编码：${selectedBom.bomCode}\t名称：${selectedBom.bomName}\n规格：${selectedBom.bomStandard}`" 
							type="line"></uni-section>
						<uni-section class="mb-10" :title="`仓库总数:${this.total} 条，可选择分页查看`" type="line"></uni-section>
					</view>
				</view>
				
				
					<uni-table ref="table" :loading="realStockLoading"
						border
						stripe 
						type="" 
						emptyText="暂无更多数据">
						
					<uni-tr style="background-color: #dbfbdb;">
						<uni-th align="left" width="5" style="font-size: 12px;color: #62c188;">序号</uni-th>
						<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">实时库存量</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">仓库编码</uni-th>
						<uni-th align="left" width="100" style="font-size: 12px;color: #62c188;">仓库名称</uni-th>
						<uni-th align="left" width="120" style="font-size: 12px;color: #62c188;">批号</uni-th>
						<uni-th align="left" width="220" style="font-size: 12px;color: #62c188;">库存组织</uni-th>
						<uni-th align="left" width="220" style="font-size: 12px;color: #62c188;">货主</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in realStockDetailList" :key="index">
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.index }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.storeNum }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.stockNo }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.stockName }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.flotCode }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.factoryName }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.ownerName }}</uni-td>
					</uni-tr>
					<uni-tr>
						<uni-td align="left" style="font-size: 12px;text-align: left;">合计</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{totalStockNum}}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
					</uni-tr>
					</uni-table>
					<view style="padding-top: 20rpx;">
						<uni-pagination 
							prevText="前一页"
							nextText="下一页"
							:page-size="pageSize" 
							:current="pageCurrent" 
							:total="total"
							@change="pageChange"/>
					</view>
			</view>
			<view style="margin: 2rpx;">
				<uni-row>
					<uni-col :span="24">
						<u-button
							type="primary"
							text="关闭"
							shape="circle" 
							customStyle="width: 240rpx;"
							@click="stockClose"
						></u-button>
					</uni-col>
				</uni-row>
			</view>
		</uni-popup>
		
		<!-- 其他合同在途领料单列表数据 -->
		<uni-popup ref="otherContractOnWayPopup" :mask-click="false">
			<view class="content">
				<view class="itme-box">
					<view class="h-table" v-if="selectedBom!== null">
						<uni-section class="mb-10" title="物料详情`" 
							:sub-title="`编码：${selectedBom.bomCode}\t名称：${selectedBom.bomName}\n规格：${selectedBom.bomStandard}`" 
							type="line"></uni-section>
						<uni-section class="mb-10" :title="`其他合同在途领料单总数:${this.otherOnWayParam.total} 条，可选择分页查看`" type="line"></uni-section>
					</view>
				</view>
				
				
					<uni-table ref="table" :loading="otherOnWayLoading"
						border
						stripe 
						type="" 
						emptyText="暂无更多数据">
						
					<uni-tr style="background-color: #dbfbdb;">
						<uni-th align="left" width="5" style="font-size: 12px;color: #62c188;">序号</uni-th>
						<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">领料数量</uni-th>
						<uni-th align="left" width="60" style="font-size: 12px;color: #62c188;">领料状态</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">合同号</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">领料单号</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">领料日期</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">领料人</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">生产组织</uni-th>
						<uni-th align="left" width="90" style="font-size: 12px;color: #62c188;">发料组织</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in otherContractOnWayDetailList" :key="index">
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.index }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.actualQty }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.documentStatusDesc }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.contractCode }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.pickBillNo }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.pickingDate }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.pickerName }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.prdOrgName }}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{ item.stockOrgName }}</uni-td>
					</uni-tr>
					<uni-tr>
						<uni-td align="left" style="font-size: 12px;text-align: left;">合计</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;">{{totalOtherOnWayQty}}</uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
						<uni-td align="left" style="font-size: 12px;text-align: left;"></uni-td>
					</uni-tr>
					</uni-table>
					<view style="padding-top: 20rpx;">
						<uni-pagination 
							prevText="前一页"
							nextText="下一页"
							:page-size="otherOnWayParam.pageSize" 
							:current="otherOnWayParam.pageCurrent" 
							:total="otherOnWayParam.total"
							@change="otherOnWayPageChange"/>
					</view>
			</view>
			<view style="margin: 2rpx;">
				<uni-row>
					<uni-col :span="24">
						<u-button
							type="primary"
							text="关闭"
							shape="circle" 
							customStyle="width: 240rpx;"
							@click="otherOnWayClose"
						></u-button>
					</uni-col>
				</uni-row>
			</view>
		</uni-popup>
		
		
		<!-- 点击选择产品 ，弹出产品类型选框，以下是依赖进来的控件 -->
		<u-popup
			:safeAreaInsetBottom="true"
			:safeAreaInsetTop="true"
			:mode="popupData.mode"
			:show="show"
			:round="popupData.round"
			:overlay="popupData.overlay"
			:borderRadius="popupData.borderRadius"
			:closeable="popupData.closeable"
			:closeOnClickOverlay="popupData.closeOnClickOverlay"
			@close="close"
			@open="open"
			customStyle="max-height: 100vh; overflow-y: auto; overflow-x: hidden;">
			<view
				class="u-popup-slot"
				:style="{
					width: '240px',
					marginTop: '20rpx',
				}">
				 <view style="margin-left: 5px;"><u--text text="选择产品:" type="info"></u--text></view>
				 <u-line></u-line>
				 <u-row customStyle="margin-bottom: 4px" v-for="(group, groupIndex) in groupedProductList" :key="groupIndex">
					<u-col span="6" v-for="(product, productIndex) in group" :key="product.productId">
						<u-tag :text="`${product.productName}`" 
						:plain="!product.checked" 
						type="warning" 
						:name="`${product.productId}`" 
						style="margin: 5px; white-space: normal; word-wrap: break-word;"
						@click="productSelected"></u-tag>
					</u-col>
					<!-- <u-col span="6">
						<u-tag :text="`选项1`" :plain="false" type="warning" :name="1" style="margin: 5px;"></u-tag>
					</u-col> -->
				</u-row>
				<u-row customStyle="margin-bottom: 4px; margin-top: 30px;" gutter="6" >
					<u-col span="6">						
						<u-button type="primary" @click="close" style="margin: 5px;">确认</u-button>
					</u-col>
					<u-col span="6">
						<!-- <u-tag :text="`选项1`" :plain="false" type="warning" :name="1" style="margin: 5px;"></u-tag> -->
						<u-button type="warning" @click="reset" style="margin-right: 5px;">重置</u-button>
					</u-col>
				</u-row>
			</view>
		</u-popup>
		<u-modal
			:content="submitContent"
			:show="submitPickingShow"
			showCancelButton
			closeOnClickOverlay
			@confirm="submitPicking"
			@cancel="() => submitPickingShow = false"
		></u-modal>
		<u-toast ref="uToast" duration="3000" />
		<!-- <u-toast ref="uToast2Success" duration="1000" /> -->
		<u-notify ref="uNotify"></u-notify>
		<uni-fab ref="fab" 
			:pattern="pattern" 
			:content="content" 
			:horizontal="horizontal" 
			:vertical="vertical"
			:direction="direction" 
			@trigger="trigger" 
			@fabClick="fabClick" />
	</view>
</template>

<script>
	
import FloatButton from '@/components/button/FloatButton'
import * as workorderApi from '@/api/order/workorder';
import * as userApi from '@/api/user';
export default {
	components: {
		FloatButton,
	},
	data() {
		return {
			queryKey: "",
			trueValue: true,
			loadingShow: false,
			submitPickingShow: false,
			submitContent: '',
			workOrderList: [],
			allSubMaterialList: [],
			list1: [{
				name: '订单用料清单',
			}],
			productList: [
				// {productId: 1, productName: "血管造影导管（半成品）", checked: false},
				// {productId: 2, productName: "连通板（半成品）", checked: false},
				
			],
			groupedProductList: [],
			popupData: {
				overlay: true,
				mode: 'right',
				closeOnClickOverlay: true
			},
			show: false,
			radios: [
				{checked: true},
				{checked: false},
				{checked: false}
			],			
			value5: "",
			value: "",
			checked: ["选中"],
			// u-checkbox-group的v-model绑定的值如果设置为某个checkbox的name，就会被默认选中
			checkboxValue1: [],
			selectedCard: null, // 选中的卡片ID
			contractCode: null,
			orderCode: null,
			productCode: null,
			bomCode: null,
			action: null,
			orderType: null,
			status: null,
			
			detailLoading: false,
			realStockLoading: false,
			
			bomMaterialLoading: false,
			
			stockShow: false,
			realStockDetailList: [],
			
			// 悬浮按钮开始
			pattern: {
				color: '#7A7E83',
				backgroundColor: '#fff',
				selectedColor: '#007AFF',
				buttonColor: '#007AFF',
				iconColor: '#fff',
				icon: 'gear'
			},
			content: [{
					iconPath: '/static/picking/refresh.png',
					selectedIconPath: '/static/picked/refresh.png',
					text: '刷新当前',
					active: false
				},{
					iconPath: '/static/picking/history.png',
					selectedIconPath: '/static/picking/history_selected.png',
					text: '领料记录',
					active: false
				},{
					iconPath: '/static/picking/doneall.png',
					selectedIconPath: '/static/picking/doneall_selected.png',
					text: '全部领料',
					active: false
				},{
					iconPath: '/static/picking/submit.png',
					selectedIconPath: '/static/picking/submit_selected.png',
					text: '提交领料',
					active: false
				}
			],
			horizontal: 'left',
			vertical: 'bottom',
			direction: 'vertical',
			// 悬浮按钮结束
			
			notifyData: {
				top: 4,
				message: 'notify顶部提示',
				type: 'warning',
				color: '#ffffff',
				bgColor: '',
				fontSize: 12,
				duration: 2500,
				safeAreaInsetTop: false
			},
			productSelectedList: [],
			isFirstLoad: false,
			
			// 每页数据量
			pageSize: 5,
			// 当前页
			pageCurrent: 1,
			// 数据总量
			total: 0,
			
			totalStockNum: 0,
			selectedBom: null,
			
			otherOnWayLoading: false,
			totalOtherOnWayQty: 0,
			otherOnWayParam: {
				// 每页数据量
				pageSize: 5,
				// 当前页
				pageCurrent: 1,
				// 数据总量
				total: 0,
				moEntryIdList: [],
				bomIdList: [],
			},
			otherContractOnWayDetailList: [],
			
			
			workerOrderChangeFlag: false,
			
			factoryId: 0,
			teamId: 0,
			teamInfo: null,
			
			prdFactorySelecteds: [],
			prdFactoryList: []
		}
	},
	watch: {
		workOrderList(newVal, oldVal) {
			this.$nextTick(() => {
				console.log("workOrderList updated:", newVal);
				// 指定部分选中
				if (this.isFirstLoad) {
					// for (let item of this.workOrderList) {
					// 	let ix = item.index - 1;
					// 	if (this.isValidateStatus(item.kingStatus)) {
					// 		this.$refs.tableOfProduct.toggleRowSelection([ix], true);
					// 	}
					// }
					this.$refs.tableOfProduct.selectionAll();
					// this.isFirstLoad = false;
					// this.queryPickingBomMaterialList();
				}
				this.workerOrderChangeFlag = true;
			});
		}
	},
	mounted() {
		//TODO
	},
	onLoad(options) {
		console.log("页面加载参数options:", options);
		if (options.factoryId) {
			this.factoryId = options.factoryId;
		}
		if (options.teamId) {
			this.teamId = options.teamId;
		}
		if (options.contractCode) {
			this.queryKey = decodeURIComponent(options.contractCode);
		}
		if (options.action) {
			this.action = options.action;
		}
		if (options.orderType) {
			this.orderType = options.orderType;
		}
		if (options.status) {
			this.status = options.status;
		}
		if (options.bomCode) {
			this.bomCode = decodeURIComponent(options.bomCode);
		}
		if (options.contractCode && options.orderCode) {
			this.contractCode = decodeURIComponent(options.contractCode);
			this.orderCode = decodeURIComponent(options.orderCode);
			// this.productCode = decodeURIComponent(options.productCode);
			this.isFirstLoad = true;
		}
		
		this.loadTeamInfoById();
		this.queryPickingDetailList();
	},
	methods: {
		isValidateStatus(status) {
			if (status === '3'
				|| status === '4' 
				|| status === '5' ) {
				return true;
			}
			return false;
		},
		loadTeamInfoById() {
			userApi.getTeamById({teamId: this.teamId}).then(response => {
				if (response && response.data) {
					this.teamInfo = response.data;
				}
			}).then(res => {
				console.log("test:", this.teamInfo);
			});
			
		},
		stockClose() {
			this.$refs.stockPopup.close();
		},
		selectionChange(e) {
			console.log("多选事件触发:", e);
			if (this.workOrderList.length === 0) {
				this.prdFactorySelecteds = [];
				return;
			}
			let prdFactorys = [];
			this.productSelectedList = [];
			for (let i of e.detail.index) {
			  const item = this.workOrderList[i];
			  if (item !== null && item !== undefined) {
				  let workOrderCodeList = [];
				  let workOrderList = item.workOrderList || [];
				  for (let obj of workOrderList) {
					  workOrderCodeList.push(obj.workerOrderCode);
				  }
				  this.productSelectedList.push({
				 	bomCode: item.bomCode,
					workOrderCodeList: workOrderCodeList,
				  });
				  if (!prdFactorys.includes(item.prdFactoryLabel)) {
					  prdFactorys.push(item.prdFactoryLabel);
				  }
			  }
			}
			console.log("选中的产品编码:", this.productSelectedList);
			let message = `您选中了${this.productSelectedList.length}个产品，还需要点击·确认按钮·进行最新物料的加载`;
			if (this.productSelectedList.length === 0) {
				message = `您选中了${this.productSelectedList.length}个产品，还未选择任何产品领料`;
			}
			this.notifyWarning(message);
			
			if (this.isFirstLoad) {
				this.isFirstLoad = false;
			} else {
				this.allSubMaterialList = [];
			}
			// 处理产地选择
			this.prdFactorySelecteds =  prdFactorys;
		},
		bomCodeSelectChange(action) {
			if (action === "OK") {
				if (this.productSelectedList.length === 0) {
					let message = `您选中了${this.productSelectedList.length}个产品，还未选择任何产品领料`;
					this.notifyWarning(message);
					this.allSubMaterialList = [];
					return;
				}
				this.queryPickingBomMaterialList();
			} else {
				this.$refs.tableOfProduct.selectionAll();
			}
		},
		notifyError(message) {
			this.notifyData.type = 'error';
			this.notifyData.message = message;
			this.$refs.uNotify.show({
				...this.notifyData
			});
		},
		notifySuccess(message) {
			this.notifyData.type = 'success';
			this.notifyData.message = message;
			this.$refs.uNotify.show({
				...this.notifyData
			});
		},
		notifyWarning(message) {
			this.notifyData.type = 'warning';
			this.notifyData.message = message;
			this.$refs.uNotify.show({
				...this.notifyData
			});
		},
		todayRecvNumChange(row, e) {
			if (!row.todayRecvNum) {
				return;
			}
			if (!(!isNaN(parseFloat(row.todayRecvNum)) && isFinite(row.todayRecvNum)) || row.todayRecvNum <= 0) {
				this.notifyError(`输入必须是大于 0 的数字`);
				return;
			}
			if (row.isMinIssueQty) {
				const todayRecvNum = Number(row.todayRecvNum);
				if (todayRecvNum % 1 !== 0) {
					this.notifyError(`${todayRecvNum},${row.bomName} 最小发料批量输入的数量必须是整数`);
					return;
				}
				const pickedCeilQty = this.ceilIfDecimal(row.pickedQty);
				if (row.appQty === pickedCeilQty) {
					this.notifyError(`${row.bomName} 最小发料批量已领完`);
					row.todayRecvNum = null;
					return;
				}
				if (todayRecvNum > row.appQty) {
					if (row.pickedQty === 0) {
						this.notifyError(`${todayRecvNum}, 不能超过申请数量:${row.appQty}`);
						row.todayRecvNum = row.appQty;
					} else {
						const result = this.ceilIfDecimal(row.noPickedQty);
						if (todayRecvNum > result) {
							this.notifyError(`${todayRecvNum}, 不能剩余的可领数量:${result}`);
							row.todayRecvNum = result;
						}
					}
				} else {
					const result = this.ceilIfDecimal(row.noPickedQty);
					if (todayRecvNum > result) {
						this.notifyError(`${todayRecvNum}, 不能剩余的可领数量:${result}`);
						row.todayRecvNum = result;
					}
				}
			} else {
				if (Number(row.todayRecvNum)>row.noPickedQty) {
					this.notifyError(`${row.todayRecvNum}, 不能超过未领数量=${row.noPickedQty}`);
					row.todayRecvNum = row.noPickedQty;
				}
			}
		},
		ceilIfDecimal(number) {
		    // 判断是否是小数
		    return number % 1 !== 0 ? Math.ceil(number) : number;
		},
		clearRecvNum(row, e) {
			console.log("row->", row);
		},
		click2Query() {
			this.isFirstLoad = true;
			this.productSelectedList = [];
			this.queryPickingDetailList();
		},
		// 处理关联数据结束
		queryPickingDetailList(call) {
			if (this.queryKey) {
				this.contractCode = this.queryKey;
			}
			
			this.bomMaterialLoading = true;
			workorderApi.queryPickingDetailByContractCodeV2({
				pageNum: 1, 
				pageSize: 2000, 
				factoryId: this.factoryId,
				teamId: this.teamId,
				orderCode: this.orderCode,
				contractCode: this.contractCode,
				productCode: this.productCode,
				bomCode: this.bomCode,
				queryKey: this.queryKey,
				action: this.action,
				orderType: this.orderType,
				status: this.status,
				productSelectedList: this.productSelectedList,
			}).then(res => {
				// console.log("领料详情查询:", res);
				if (res && res.data) {
					// this.workOrderList = res.data.noMergeList || [];
					this.allSubMaterialList = res.data.allSubMaterialList || [];
				}
				
				if (this.prdFactoryList.length === 0) {
					let prdFactoryLabels = res.data.prdFactoryLabels || [];
					for (let obj of prdFactoryLabels) {
						this.prdFactoryList.push({value: obj, text: obj});
						this.prdFactorySelecteds.push(obj);
					}
				}
				this.workOrderList = res.data.noMergeList || [];
				this.bomMaterialLoading = false;
				if (call) {
					call();
				}
								
			}).catch(err => {
				// 提交异常
				console.error("领料查询发生异常", err);
				this.bomMaterialLoading = false;
				this.allSubMaterialList = [];
				if (call) {
					call();
				}
			});
		},
		// 处理关联数据结束
		queryPickingBomMaterialList() {
			if (this.queryKey) {
				this.contractCode = this.queryKey;
			}
			this.bomMaterialLoading = true;
			
			workorderApi.queryPickingDetailByContractCodeV2({
				pageNum: 1, 
				pageSize: 2000, 
				factoryId: this.factoryId,
				teamId: this.teamId,
				orderCode: this.orderCode,
				contractCode: this.contractCode,
				productCode: this.productCode,
				queryKey: this.queryKey,
				action: this.action,
				orderType: this.orderType,
				status: this.status,
				productSelectedList: this.productSelectedList,
			}).then(res => {
				// console.log("领料详情查询:", res);
				if (res && res.data) {
					// this.workOrderList = res.data.noMergeList || [];
					this.allSubMaterialList = res.data.allSubMaterialList || [];
				}
				if (this.prdFactoryList.length === 0) {
					let prdFactoryLabels = res.data.prdFactoryLabels || [];
					for (let obj of prdFactoryLabels) {
						this.prdFactoryList.push({value: obj, text: obj});
						this.prdFactorySelecteds.push(obj);
					}
				}
				this.bomMaterialLoading = false;
				
			}).catch(err => {
				// 提交异常
				console.error("领料物料明细查询发生异常", err);
				this.bomMaterialLoading = false;
				this.allSubMaterialList = [];
				if (call) {
					call();
				}
			});
		},
		queryPickedQtyByContractNo(workList, contractNo) {
			const queryParam = {
				factoryId: this.factoryId,
				teamId: this.teamId,
				contractNo: contractNo,
			};
			workorderApi.findPickedQtyByContractNo(queryParam).then(res => {
				if (res && res.data) {
					// TODO
					const qtyMap = res.data.productQtyBoMap;
					for (let obj of workList) {
						const qty = qtyMap[obj.productCode+'/'+obj.bomCode];
						if (qty) {
							obj.needPickedQty = qty.needPickedQty;
							obj.noPickedQty = qty.noPickedQty;
							obj.pickedQty = qty.pickedQty;
						}
					}
					this.workOrderList = workList;
				}
			}).catch(err => {
				// 提交异常
				console.error("获取一个合同号的领料数据发生异常", err);
				this.workOrderList = workList;
			});
		},
		submitPickingPreOfNoCheckAll() {
			if (this.allSubMaterialList.length === 0) {
				this.notifyError(`物料清单为空，无法操作全部领料`);
				return;
			}
			for (let item of this.allSubMaterialList) {
				if (item.noPickedQty <= 0) {
					continue;
				}
				item.todayRecvNum = null;
			}
		},
		submitPickingPreOfAll() {
			if (this.allSubMaterialList.length === 0) {
				this.notifyError(`物料清单为空，无法操作全部领料`);
				return;
			}
			for (let item of this.allSubMaterialList) {
				if (item.noPickedQty <= 0) {
					continue;
				}
				if (item.isMinIssueQty) {
					const result = this.ceilIfDecimal(item.noPickedQty);
					item.todayRecvNum = result;
				} else {
					item.todayRecvNum = item.noPickedQty;
				}
			}
		},
		submitPickingPre() {
			if (!this.allSubMaterialList || this.allSubMaterialList.length == 0) {
				this.notifyError(`物料清单为空，无法操作提交物料`);
				return;
			}
			let submitingList = this.allSubMaterialList.filter(item => {
			  const recvNum = item.todayRecvNum ? Number(item.todayRecvNum) : 0;
			  return recvNum > 0;
			});			
			let cur = this.workOrderList[0];
			this.submitContent = `确认要提交批量领料请求吗？
				合同号：${cur.contractCode}
				领料物料种类数：${submitingList.length} 种
				领料班组：${this.teamInfo ? this.teamInfo.deptName : this.teamId}`;
			this.submitPickingShow = true;
		},
		submitPicking() {
			console.log('提交领料数据');
			
			if (this.productSelectedList.length === 0) {
				this.notifyError(`您还未选择任何需要领料的产品信息，先选择产品`);
				return;
			}
			
			let cur = this.workOrderList[0];
			let allMaterialList = [];
			for(let item of this.allSubMaterialList) {
				if (item.todayRecvNum && item.todayRecvNum > 0) {
					allMaterialList.push(item);
				}
			}
			let submitParam = {
				factoryId: this.factoryId,
				teamId: this.teamId,
				contractCode: cur.contractCode,
				orderCode: cur.orderCode,
				allSubMaterialList: allMaterialList,
				productSelectedList: this.productSelectedList,
			};
			workorderApi.submitPickingV4(submitParam).then(res => {
				// 提交结果
				// console.log("领料提交返回：",  res);
				if (res.code == 200) {
					// this.$refs.uToast.success(`提交成功`);
					this.submitPickingShow = false;
					this.notifySuccess(`领料单提交成功，等待推送金蝶送料！`);
					this.queryPickingBomMaterialList();
				} else {
					this.notifyError(`提交失败,原因：${res.msg}`);
				}
			}).catch(err => {
				// 提交异常
				console.error("领料提交发生异常", err);
				this.notifyError(`领料提交发生异常,请联系相关人员进行处理`);
			});
		},
		groupedProducts() {
			const size = 2;
		      return this.productList.reduce((result, item, index) => {
		        const chunkIndex = Math.floor(index / size);
		        if (!result[chunkIndex]) {
		          result[chunkIndex] = [];
		        }
		        result[chunkIndex].push(item);
		        return result;
		      }, []);
		},
		productSelected(name){
			const found = this.productList.find(item => item.productId === Number(name));
			console.log("click", name, found);
			if (found) {
				found.checked = !found.checked;
			}
			for(let item of this.productList) {
				if(item.productId !== found.productId) {
					item.checked = false;
				}
			}
		},
		prdFactoryChange(e) {
			let selectedList  = e.detail.value;
			if (selectedList.length == 0) {
				this.$refs.tableOfProduct.clearSelection();
				return;
			}
			for(let i=0; i < this.workOrderList.length; i++) {
				let item = this.workOrderList[i];
				if (selectedList.includes(item.prdFactoryLabel)) {
					this.$refs.tableOfProduct.toggleRowSelection([i], true);
				} else {
					this.$refs.tableOfProduct.toggleRowSelection([i], false);
				}
			}
			console.log("onchange", e.detail.value);
		},
		tabClick(item) {
			console.log('item', item);
			// uni.$u.sleep().then(() => {
			// 	this.show = !this.show
			// });
			// this.groupedProductList = this.groupedProducts();
		},
		floatOnclick() {
			console.log("float");
		},
		openOfCollapse(e) {
		  // console.log('open', e)
		},
		closeOfCollapse(e) {
		  // console.log('close', e)
		},
		changeOfCollapse(e) {
		  // console.log('change', e)
		},
		open() {
			// console.log('open');
			document.body.style.overflow = 'hidden'; // 禁用背景页面滚动
		},
		close() {
			this.show = false
			// console.log('close');
			document.body.style.overflow = ''; // 恢复背景页面滚动
		},
		reset() {
			for(let item of this.productList) {
				item.checked = false;
			}
		},
		load() {
			// dom 结构加载完毕时触发
			console.log("load finished");
		},
		ready() {
			// 渲染完毕时触发
			console.log("ready finished");
		},
		textConvert(label, value) {
			return `${label}: ${value}`;
		},
		textConvertOfObj(label, work) {
			if (work.hasPickingNum > 0 && work.hasPickingNum != work.maxPickingNum) {
				return `${label}: 部分领料`;
			}
			return `${label}: ${work.hasPickingNum}`;
		},
		pageChange(e) {
			this.pageCurrent = e.current;
			if (this.selectedBom) {
				this.loadRealStockNumByBomCode(this.selectedBom);
			}
		},
		loadRealStockNumByBomCode(oneBom) {
			this.selectedBom = oneBom;
			let queryParam = {
				pageCurrent: this.pageCurrent,
				pageSize: this.pageSize,
				factoryId: this.factoryId,
				teamId: this.teamId,
				materilIdList: [{supplyId: oneBom.supplyId, bomCode:oneBom.bomCode}]
			};
			workorderApi.getRealTimeStockListByPage(queryParam).then(res => {
				// 提交结果
				console.log("获取单个物料实时库存返回：",  res);
				if (res.code == 200) {
					// this.$refs.uToast.success(`查询成功`);
					this.realStockLoading = false;
					// 1 弹出库存列表信息
					this.$refs.stockPopup.open('top');
					
					this.realStockDetailList = res.rows || [];
					this.total = res.total || 0;
					if (res.footer && res.footer.length >0 ) {
						this.totalStockNum = res.footer[0].totalStockNum;
					}
					oneBom.realStockNum = this.totalStockNum;
					
				} else {
					this.notifyError(`获取单个物料实时库存失败,原因：${res.msg}`);
				}
			}).catch(err => {
				// 提交异常
				console.error("获取单个物料实时库存发生异常", err);
			});
		},
		loadRealStockNum() {
			
			this.realStockLoading = true;
			let materilIdList = [];
			for(let item of this.allSubMaterialList) {
				materilIdList.push({supplyId: item.supplyId, bomCode:item.bomCode});
			}
			let queryParam = {
				factoryId: this.factoryId,
				teamId: this.teamId,
				materilIdList: materilIdList
			};
			workorderApi.getRealTimeStockList(queryParam).then(res => {
				// 提交结果
				console.log("获取物料实时库存返回：",  res);
				if (res.code == 200) {
					// this.$refs.uToast.success(`查询成功`);
					this.realStockLoading = false;
					// 刷新表格数据
					const bomCodeMap = this.groupBomAndSumStoreNum(res.data||[]);
					for (let item of this.allSubMaterialList) {
						let found = bomCodeMap.get(item.bomCode);
						if (found) {
							item.realStockNum = found;
						} else {
							item.realStockNum = "0";
						}
					}
				} else {
					this.notifyError(`获取物料实时库存失败,原因：${res.msg}`);
				}
			}).catch(err => {
				// 提交异常
				console.error("获取物料实时库存发生异常", err);
			});
		},
		groupBomAndSumStoreNum(data) {
		    const resultMap = new Map();
		    data.forEach(item => {
		        const { bomCode, storeNum } = item;
		
		        // 将storeNum转换为数字，如果为null或空字符串，则视为0
		        const value = storeNum ? Number(storeNum) : 0;
		
		        // 如果Map中已存在该bomCode，则累加storeNum
		        if (resultMap.has(bomCode)) {
					const currentSum = resultMap.get(bomCode);
					const newSum = (currentSum + value).toFixed(4);
					resultMap.set(bomCode, parseFloat(newSum));
		        } else {
		            // 否则初始化为当前storeNum值
		            resultMap.set(bomCode, parseFloat(value.toFixed(4)));
		        }
		    });
		
		    return resultMap;
		},
		
		// 其他合同在途领料单数据
		otherOnWayClose() {
			this.$refs.otherContractOnWayPopup.close();
		},
		otherOnWayPageChange(e) {
			this.otherOnWayParam.pageCurrent = e.current;
			if (this.selectedBom) {
				this.loadOtherOnWayQty(this.selectedBom);
			}
		},
		loadOtherOnWayQty(oneBom) {
			this.selectedBom = oneBom;
			
			this.otherOnWayLoading = true;
			this.otherOnWayParam.moEntryIdList = [];
			this.otherOnWayParam.bomIdList = [];
			let parentBomCodeList = oneBom.parentBomCodeList || [];
			for(let obj of parentBomCodeList) {
				this.otherOnWayParam.moEntryIdList.push(obj.moEntryId);
			}
			this.otherOnWayParam.bomIdList.push(oneBom.bomCode);
			
			workorderApi.getNoneSelfOnwayPickingListByPage(this.otherOnWayParam).then(res => {
				// 提交结果
				console.log("获取单个物料其他合同在途领料单返回：",  res);
				if (res.code == 200) {
					// this.$refs.uToast.success(`查询成功`);
					this.otherOnWayLoading = false;
					// 1 弹出其他合同在途领料单列表数据
					this.$refs.otherContractOnWayPopup.open('top');
					
					this.otherContractOnWayDetailList = res.rows || [];
					this.otherOnWayParam.total = res.total || 0;
					if (res.footer && res.footer.length >0 ) {
						this.totalOtherOnWayQty = res.footer[0].totalPickingQty;
					}
					oneBom.otherContractOnWayQty = this.totalOtherOnWayQty;
					
				} else {
					this.notifyError(`获取单个物料其他合同在途领料单返回失败,原因：${res.msg}`);
				}
			}).catch(err => {
				// 提交异常
				console.error("获取单个物料其他合同在途领料单返回发生异常", err);
			});
		},
		loadAllOtherOnWayQty() {
			this.otherOnWayLoading = true;
			let bomIdList = [];
			let moEntryIdList = [];
			for (let item of this.allSubMaterialList) {
				bomIdList.push(item.bomCode);
				let parentBomCodeList = item.parentBomCodeList || [];
				for (let obj of parentBomCodeList) {
					if(!moEntryIdList.includes(obj.moEntryId)) {
						moEntryIdList.push(obj.moEntryId);
					}
				}
			}
			let queryParam = {
				moEntryIdList: moEntryIdList,
				bomIdList: bomIdList
			};
			workorderApi.getAllNoneSelfOnwayPicking(queryParam).then(res => {
				// 提交结果
				console.log("获取所有物料其他合同在途领料单返回：",  res);
				if (res.code == 200) {
					this.notifySuccess(`查询成功`);
					this.otherOnWayLoading = false;
					// 刷新表格数据
					let result = res.data || {};
					for (let item of this.allSubMaterialList) {
						let found = result[item.bomCode];
						if (found) {
							item.otherContractOnWayQty = found;
						} else {
							item.otherContractOnWayQty = "0";
						}
					}
				} else {
					this.notifyError(`获取所有物料其他合同在途领料单返回失败,原因：${res.msg}`);
				}
			}).catch(err => {
				// 提交异常
				console.error("获取所有物料其他合同在途领料单返回发生异常", err);
			});
		},
		
		trigger(e) {
			console.log(e);
			const btn = this.content[e.index];
			btn.active = true;
			if (btn.text === '刷新当前') {
				this.queryPickingDetailList(() => {
					btn.active = false;
				});
			} else if (btn.text === '领料记录') {
				// uni.showModal({
				// 	title: '提示',
				// 	content: `您${btn.active ? '选中了' : '取消了'}${e.item.text}`,
				// 	success: (res) => {
				// 		if (res.confirm) {
				// 			console.log('用户点击确定')
				// 		} else if (res.cancel) {
				// 			console.log('用户点击取消')
				// 		}
				// 		btn.active = false;
				// 	}
				// })
				const contractCode = encodeURIComponent(this.contractCode);
				this.navigateTo(`/pages/work/order/pickedHistory?factoryId=${this.factoryId}&teamId=${this.teamId}&contractCode=${contractCode}`);
			} else if (btn.text === '全部领料') {
				this.submitPickingPreOfAll();
				btn.active = false;
				btn.text = "取消全部";
			} else if (btn.text === '取消全部') {
				this.submitPickingPreOfNoCheckAll();
				btn.active = true;
				btn.text = "全部领料";
			} else if (btn.text === '提交领料') {
				this.submitPickingPre();
			}
		},
		fabClick() {
			// uni.showToast({
			// 	title: '点击了悬浮按钮',
			// 	icon: 'none'
			// })
		},
		// 跳转到指定页面
		navigateTo (url) {
		  uni.navigateTo({ url: url })
		},
	}
}
</script>

<style lang="scss" scoped>

.card-container{
	width: 100%;
	min-height: 100%;
	box-sizing: border-box;
	padding: 8rpx;
	background-color: #ECECEC;
}
.card-wrap{
	padding: 12rpx;
	border-radius: 12rpx;
	margin-bottom: 12rpx;
	background-color: #FFF;
	border: 1px solid #ddd; /* 默认边框 */
	transition: background-color 0.3s, border-color 0.3s;
	.card-item{
		display: flex;
		align-items: center;
		font-size: 28rpx;
		padding-bottom: 20rpx;
		color: #111111;
	}
	.card-item-txt{
		flex:1;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}
.card-btns{
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.card-btns uni-button {
  flex: 1;
  margin: 0 5px; /* 调整按钮间距 */
}
.card-wrap-selected {
  border-color: #007bff; /* 选中状态的边框颜色 */
  background-color: #e7f0ff; /* 选中状态的背景颜色 */
}

.demo-layout {
	// height: 25px;
	border-radius: 0px;
}
.bg-purple {
	background: #CED7E1;
}
.bg-purple-light {
	background: #e5e9f2;
}
.border-row {
  box-sizing: border-box; 
  border-top: 1px solid #dfe2e5; 
  border-left: 1px solid #dfe2e5;
  border-right: 1px solid #dfe2e5; 
  border-bottom: 0.2px solid #dfe2e5;
  padding: 8px;             /* 可选：内边距 */
}
/deep/ .u-collapse-item__content__text {
	padding: 2px 8px !important;
	color: #606266 !important;
	font-size: 14px !important;
	line-height: 18px !important;
}

.card-item-layout{
	border-radius: 6rpx;
	background-color: #FFF;
	// border: 1px solid #ddd; /* 默认边框 */
	transition: background-color 0.3s, border-color 0.3s;
	align-items: left;
	font-size: 28rpx;
	color: #40485d;
}

.card-item-single{
	border-radius: 6rpx;
	background-color: #FFF;
	border: 1px solid #ddd; /* 默认边框 */
	transition: background-color 0.3s, border-color 0.3s;
	align-items: left;
	font-size: 30rpx;
	color: #40485d;
}

.float-button {
  position: fixed;
  bottom: 6px;
  left: 50%;
  // width: 52px;
  // height: 52px;
  // transform: translateX(-50%);
  z-index: 10;
}
.float-button-right {
  position: fixed;
  bottom: 6px;
  right: 50%;
  // width: 52px;
  // height: 52px;
  // transform: translateX(-50%);
  z-index: 10;
}


/* 示例样式开始 */
.content {
	font-size: 28rpx;
	background-color: #f3f3f3;
	padding: 10rpx;
	
	.red{
		background-color: #DD524D;
		color: #fff;
		text-align: center;
	}
	
	.green{
		background-color: #42b983;
		color: #fff;
		text-align: center;
	}
	
	.blue{
		background-color: #007AFF;
		color: #fff;
		text-align: center;
	}
	
	.yellow{
		background-color: #ffaa00;
		color: #fff;
		text-align: center;
	}
	

	.itme-box {
		padding: 10rpx;
		background-color: #fff;
		margin-bottom: 10rpx;

		.title {
			padding-bottom: 12rpx;
			margin-bottom: 12rpx;
			border-bottom: #e5e5e5 solid 1px;
			line-height: normal;
		}
		
		// .width-fill{
		// 	width: 100%;
		// }
		
		.preview-box{
			height: 400rpx;
			box-shadow: 0 0 4px rgba(0,0,0,0.3);
		}
	}
}
/* 示例样式结束 */

.td_header {
	color: rgb(98, 193, 136);
	background-color: #dbfbdb;
}

.uni-container {
	height: 100rpx;
	margin-top: 50rpx;
	position: relative;
}
 
/* //表头固定样式 */
::v-deep .tableHead {
	font-weight: bold;
	color: #333333;
	background: #F4F6FF;
	z-index: 20;
	position: absolute;
	top: 0rpx;
}

::v-deep .tableBody {
	height: 500px;
	overflow: scroll;
	margin-top: 44px;
	background-color: #fff;
}
</style>
